//
//  SLStatuBottomView.swift
//  0319iOSweiboDemo
//
//  Created by Tang on 16/3/25.
//  Copyright © 2016年 大天朝. All rights reserved.
//

import UIKit

class SLStatuBottomView: UIView {

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        perpareUI()
//        backgroundColor = UIColor.orangeColor()
    }
    
   private func perpareUI() {
        //添加子控件
        addSubview(forwardButton)
        addSubview(commentButton)
        addSubview(likeButton)
        addSubview(separetorViewFirst)
        addSubview(separetorViewSecond)
        //添加约束
        //3个按钮平铺
        //转发按钮
        forwardButton.snp_makeConstraints { (make) -> Void in
            make.leading.top.bottom.equalTo(self)
            
        }
    
        //评论按钮
        commentButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(forwardButton.snp_trailing)
            make.top.bottom.equalTo(self)
            
            //宽度.三个相等
            make.width.equalTo(forwardButton)
        }
    
        //赞
        likeButton.snp_makeConstraints { (make) -> Void in
          make.leading.equalTo(commentButton.snp_trailing)
            make.top.trailing.bottom.equalTo(self)
            //宽度.三个相等
            make.width.equalTo(commentButton)
        }
        //分割线1
        separetorViewFirst.snp_makeConstraints { (make) -> Void in
           make.centerX.equalTo(forwardButton.snp_trailing)
            make.centerY.equalTo(forwardButton)
        }
        //分割线2
        separetorViewSecond.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentButton.snp_trailing)
            make.centerY.equalTo(commentButton)
        }
    }
    
    
    //MARK: - 懒加载
    
    //分割线1
    private lazy var separetorViewFirst: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    //分割线2
    private lazy var separetorViewSecond: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    
    //转发按钮
    private lazy var forwardButton: UIButton = UIButton(title: "转发", imageName: "timeline_icon_retweet", bkgImageName: "timeline_card_bottom_background", textColor: UIColor.lightGrayColor(), textFoun: 11)
    
    
    //评论按钮
    private lazy var commentButton: UIButton = UIButton(title: "评论", imageName: "timeline_icon_comment", bkgImageName: "timeline_card_bottom_background", textColor: UIColor.lightGrayColor(), textFoun: 11)

    
    //赞按钮
    private lazy var likeButton: UIButton = UIButton(title: "赞", imageName: "timeline_icon_unlike", bkgImageName: "timeline_card_bottom_background", textColor: UIColor.lightGrayColor(), textFoun: 11)
    
}

